package net.cityside.summer.mapper;

import net.cityside.summer.domain.User;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

public interface UserMapper {

	/** 不加载authorities和info属性。 */
	User getById(long id);

	@Select("select * from USER where username = #{username}")
	User getByUserName(String username);

	User getWithInfoById(long id);

	/** 数据库产生的id回写入user.id。返回插入的行数。 */
	int save(User user);

	/** 返回删除的行数。 */
	@Delete("delete from USER where id = #{id}")
	int reomveById(long id);

	User getWithAuthoritiesById(long id);

	User getWithAuthoritiesByUserName(String username);

}
